cmake_minimum_required (VERSION 2.6)

PROJECT(BubblesOS CXX C)

set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")

set(KINCLUDES "-DKERNEL -I. -I${CMAKE_SOURCE_DIR} -I${CMAKE_SOURCE_DIR}/lib/stdc/include -I${CMAKE_SOURCE_DIR}/lib/stdcxx/include -I${CMAKE_SOURCE_DIR}/../plsdk/plcore")

SET(LIB_CXX_SRC
)

SET(LIB_CXX_EXCEPTION_SRC
	include/exception
	include/typeinfo
	include/_typeinfo/__array_type_info.h
	include/_typeinfo/__base_class_type_info.h
	include/_typeinfo/__class_type_info.h
	include/_typeinfo/__enum_type_info.h
	include/_typeinfo/__function_type_info.h
	include/_typeinfo/__fundamental_type_info.h
	include/_typeinfo/__pbase_type_info.h
	include/_typeinfo/__pointer_to_member_type_info.h
	include/_typeinfo/__pointer_type_info.h
	include/_typeinfo/__si_class_type_info.h
	include/_typeinfo/__vmi_class_type_info.h
	include/_typeinfo/tinfo.h
	include/unwind/unwind-cxx.h
	src/exception/exception.cpp
	src/typeinfo/arraytypeinfo.cpp
	src/typeinfo/badcast.cpp
	src/typeinfo/badtypeid.cpp
	src/typeinfo/baseclasstypeinfo.cpp
	src/typeinfo/classtypeinfo.cpp
	src/typeinfo/dynamiccast.cpp
	src/typeinfo/ehauxruntime.cpp
	src/typeinfo/enumtypeinfo.cpp
	src/typeinfo/functiontypeinfo.cpp
	src/typeinfo/fundamentaltypeinfo.cpp
	src/typeinfo/pbasetypeinfo.cpp
	src/typeinfo/pmemtypeinfo.cpp
	src/typeinfo/pointertypeinfo.cpp
	src/typeinfo/siclasstypeinfo.cpp
	src/typeinfo/typeinfo.cpp
	src/typeinfo/vmiclasstypeinfo.cpp
	src/unwind/resume.cpp
)

SET(LIB_CXX_LIB_SRC
	${LIB_CXX_SRC}
	${LIB_CXX_EXCEPTION_SRC}
)

SET(CMAKE_CXX_COMPILE_OBJECT "${gplusplus} ${KFLAGS} ${WFLAGS} ${OPTIMIZEFLAGS} ${KINCLUDES} -c -o <OBJECT> <SOURCE>")
SET(CMAKE_C_COMPILE_OBJECT "${gcc} ${KCFLAGS} ${WFLAGS} ${OPTIMIZEFLAGS} ${KINCLUDES} -c -o <OBJECT> <SOURCE>")
SET(CMAKE_AR "${gar}")
SET(CMAKE_RANLIB "${granlib}")
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> r  <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
SET(CMAKE_CXX_ARCHIVE_CREATE ${CMAKE_C_ARCHIVE_CREATE})
SET(CMAKE_CXX_ARCHIVE_APPEND ${CMAKE_C_ARCHIVE_APPEND})
SET(CMAKE_CXX_ARCHIVE_FINISH ${CMAKE_C_ARCHIVE_FINISH})

add_library( libcxx STATIC
	${LIB_CXX_LIB_SRC}
)

#add_library( cxx SHARED
#	${LIB_CXX_LIB_SRC}
#)
